package com.vzaar.examples;

import com.vzaar.Vzaar;
import com.vzaar.VzaarException;

/**
 * Example showing the video delete command.
 * 
 * @author Marc G. Smith
 */
public class VideoEditExample 
{
	///////////////////////////////////////////////////////////////////////////

	public static void main(String[] args) {
		try {
			ParameterHelper helper = new ParameterHelper(args);
			args = helper.getRemainingArgs();
			if(args.length != 3) {
				printUsage();
				System.exit(1);
				return;
			}
			
			Vzaar vzaar = helper.createVzaar();
			vzaar.editVideo(
				Integer.parseInt(args[0]),
				args[1],
				args[2]);
		}
		catch(VzaarException e) {
			System.err.println("Error: " + e.getMessage());
			System.exit(2);
		}
		catch(ArrayIndexOutOfBoundsException e) {
			printUsage();
			System.exit(1);
		}
		catch(NumberFormatException e) {
			printUsage();
			System.exit(1);
		}
	}
	
	///////////////////////////////////////////////////////////////////////////

	private static final  void printUsage() {
		System.out.println("Usage: vzaar-edit " +
			ParameterHelper.getCommonCommandLineArgs() + " <videoId>" +
			" <title> <description>\n");
		System.out.println("   <videoId>           " +
			"The video number of the video");
		System.out.println("   <title>             " +
			"The video title");
		System.out.println("   <description>       " +
			"The video description");
		System.out.println(ParameterHelper.getCommonCommandLineHelp());
	}
	
	///////////////////////////////////////////////////////////////////////////
}
